package api;

public class Test {
    public static void main(String[] args) {
        String s = new StringBuilder().append("abc").toString();
        System.out.println(s.intern() == s); // false

        String s2 = new String("abc");
        String s3 = "abc";
        System.out.println(s2 == s3); // false
        System.out.println(s2.intern() == s3); // true

        String s4 = new StringBuilder().append("123").append("2").toString();
//        String s5 = "123" + "2";
        System.out.println(s4.intern() == s4); // false 注释上一句就是true

    }
}
